home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
simula
/
books
/
books.lha
/
kirkerud
/
average.sim
< prev
next >
Wrap
Text File
|
1993-08-16
|
679b
|
26 lines
begin
integer count; real obs, sum;
outtext("Type your observations."); outimage;
outtext("Type 0 after the last!"); outimage;
count := 0; sum := 0;
inimage; obs := inreal;
while obs > 0 do
begin
sum := sum + obs;
count := count + 1;
inimage; obs := inreal;
end;
if count = 0 then
begin
outtext("You did not type any observations!");
outimage;
end
else
begin
outtext("Number of observations typed: ");
outint(count, 5); outimage;
outtext("Average value: ");
outfix(sum/count, 3, 10); outimage;
end;
end